package edu.hainnu.niit.service.Impl;

import edu.hainnu.niit.dao.Leave_messageDao;
import edu.hainnu.niit.model.Leave_message;
import edu.hainnu.niit.service.ILeave_messageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

/**
 * TODO
 *
 * @package_name edu.hainnu.niit.service.Impl
 * @auther GGB
 * @date 2021/12/12
 * @time 14:47
 */
@Service
public class Leave_messageServicelmpl implements ILeave_messageService {
    @Resource
    Leave_messageDao leave_messageDao;
    @Override
    public boolean InsertLeaveMessage(Leave_message leave_message) {
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDate localDate = LocalDate.now();
        ZonedDateTime zdt = localDate.atStartOfDay(zoneId);
        Date date = Date.from(zdt.toInstant());
        leave_message.setLtime(date);
        System.out.println(leave_message);
        int flag = leave_messageDao.insertMessageDao(leave_message);
        /*if(flag>0){
            return true;
        }else {
            return false;
        }*/
        return true;
    }
}
